<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('健康登记列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="name"/>
                            </li>
                            <li>
                                <label>身份证号：</label>
                                <input type="text" name="idCard"/>
                            </li>
                            <li>
                                <label>本人电话：</label>
                                <input type="text" name="phone"/>
                            </li>
                            <li>
                                <label>婚姻状况：</label>
                                <select name="marry" th:with="type=${@dict.getType('marry')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>当前状态：</label>
                                <select name="flag">
                                    <option value="">所有</option>
                                    <option value="2">等待审核</option>
                                    <option value="3">初审驳回</option>
                                    <option value="4">初审完成</option>
                                    <option value="5">终审驳回</option>
                                    <option value="6">审核完成</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>提审时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginSubmitTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endSubmitTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">

            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:health_register:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:health_register:remove')}]];
        var marryDatas = [[${@dict.getType('marry')}]];
        var prefix = ctx + "system/health_register";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                healthUrl: prefix + "/edit_health/{id}",
                queryHealthUrl: prefix + "/query_health/{id}",
                modalName: "健康登记",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'canExamine',
                    title: '',
                    visible: false
                },
                {
                    field: 'name',
                    title: '姓名'
                },
                {
                    field: 'sex',
                    title: '性别',
                    formatter: function(value, row, index) {
                        if(value == 1){
                            return "男";
                        }else if(value == 0){
                            return "女";
                        }else{
                            return ""
                        }

                    }
                },
                {
                    field: 'birthday',
                    title: '出生日期'
                },
                {
                    field: 'idCard',
                    title: '身份证号'
                },
                {
                    field: 'phone',
                    title: '本人电话'
                },
                {
                    field: 'marry',
                    title: '婚姻状况',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(marryDatas, value);
                    }
                },
                {
                    field: 'flag',
                    title: '当前状态',
                    formatter: function(value, row, index) {
                        if(value == 1){
                            return "未提交";
                        }else if(value == 2){
                            return "未审核";
                        }else if(value == 3){
                            return "初审驳回";
                        }else if(value == 4){
                            return "初审通过";
                        }else if(value == 5){
                            return "终审驳回";
                        }else if(value == 6){
                            return "审核通过";
                        }else{
                            return "状态异常";
                        }
                    }
                },
                {
                    field: 'remark',
                    title: '备注',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value, 10, "open");
                    }
                },
                {
                    field: 'submitTime',
                    title: '提审时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.canExamine){
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.examine_health(\'' + row.id + '\')"><i class="fa fa-edit"></i>审核</a> ');
                        }else{
                            actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.detailHealth(\'' + row.id + '\')"><i class="fa fa-search"></i>查看</a> ');
                        }
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>